<?php
namespace app\controller;

use app\BaseController;
use app\middleware\Auth;
use think\facade\Db;

class Index extends BaseController
{
    public function index()
    {
        $arr = array_map(function ($middleware) {
            return function () use ($middleware) {
                echo "<pre>";
                var_dump($middleware);
                exit();
            };
        }, ['func_a', 'func_b']);
        echo "<pre>";
        var_dump(123);
        exit();
        $config = parse_ini_file($this->app->getRootPath() . '.env', true);
        echo "<pre>";
        var_dump(array_change_key_case($config, CASE_UPPER));
        exit();
        $test = new Test();
        $test->setName('zhangxiaotian');
        echo "<pre>";
        var_dump($test);
        exit();
        return $test->getName();

        Db::table('z')->where('name', 'x')->find();
        $a = new Test();
        $b = new Test();
        $a->a();
        $b->a();

        echo "<pre>";
        var_dump(['a' => $a->get(), 'b' => $b->get()]);
        exit();
        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">14载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
    }

    public function test() {
    }


    public function hello($name = 'ThinkPHP6')
    {
        echo "<pre>";
        var_dump(Auth::class);
        exit();
        return 'hello,' . $name;
    }


}

/**
 * Class Test
 * @property String name
 * @package app\controller
 */
class Test {
    private $arr = [];

    public function getName () {
        return $this->name;
    }

    public function setName($value) {
        $this->name = $value;
    }

    public function get($key) {
        return $this->arr[$key] ?? 'test';
    }

    public function __get($index) {
        return $this->get($index);
    }

    public function __set($key, $value) {
        $this->arr[$key] = $value;
    }

}
